package com.smartfactory.sail.controller;

import com.ada.base.common.ApiResponse;
import com.ada.base.common.ControllerResponse;
import com.smartfactory.sail.dto.ContractAmountDto;
import com.smartfactory.sail.dto.DeviceUseStatusDto;
import com.smartfactory.sail.dto.PersonRankingDto;
import com.smartfactory.sail.dto.ShowOrderNumDto;
import com.smartfactory.sail.service.*;
import com.smartfactory.sail.vo.item.indexWpResp;
import com.smartfactory.sail.vo.order.IndexOrderItemStatResp;
import com.smartfactory.sail.vo.statics.IndexDHTXVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 王巨壁
 * @title: StatisticsController
 * @projectName smart-sail
 * @description: 统计接口
 * @date 2019/8/2816:59
 */
@Api(tags = "统计接口")
@RestController("statistics")
public class StatisticsController extends ControllerResponse {

    private IContractService iContractService;
    private IOrderService iOrderService;
    private IOrderItemService iOrderItemService;
    private IDeviceService iDeviceService;
    private IPurchaseService iPurchaseService;

    public StatisticsController(IContractService iContractService, IOrderService iOrderService, IOrderItemService iOrderItemService, IDeviceService iDeviceService, IPurchaseService iPurchaseService) {
        this.iContractService = iContractService;
        this.iOrderService = iOrderService;
        this.iOrderItemService = iOrderItemService;
        this.iDeviceService = iDeviceService;
        this.iPurchaseService = iPurchaseService;
    }

    @ApiOperation(value = "订销管理-查询签单金额", notes = "查询签单金额")
    @GetMapping("/DX/signAmount")
    public ApiResponse<ContractAmountDto> getSignAmount() {
        return ok(iContractService.getSignAmount());
    }

    @ApiOperation(value = "订销管理-查询订单信息数量", notes = "查询订单信息数量")
    @GetMapping("/DX/orderNum")
    public ApiResponse<ShowOrderNumDto> getOrderNum() {
        return ok(iOrderService.getOrderNum());
    }

    @ApiOperation(value = "订销管理-个人业务排行统计", notes = "个人业务排行统计")
    @GetMapping("/DX/personRanking")
    public ApiResponse<PersonRankingDto> getPersonRanking() {
        return ok(iOrderService.getPersonRanking());
    }


    @ApiOperation(value = "生产-首页数量统计", notes = "生产-首页数量统计")
    @GetMapping("/SC/indexStat")
    public ApiResponse<IndexOrderItemStatResp> indexStat(long deptId) {
        return ok(iOrderItemService.indexStat(deptId));
    }

    @ApiOperation(value = "生产-首页生产产品统计", notes = "生产-首页生产产品统计")
    @GetMapping("/SC/indexWp")
    public ApiResponse<List<indexWpResp>> indexWp(long deptId) {
        return ok(iOrderItemService.indexWp(deptId));
    }
    @ApiOperation(value = "设备-使用状态统计", notes = "设备-使用状态统计")
    @GetMapping("/SB/deviceUseStatus")
    public ApiResponse<DeviceUseStatusDto> getDeviceUseStatus() {
        return ok(iDeviceService.getDeviceUseStatus());
    }


    @ApiOperation(value = "采购-到货提醒", notes = "采购-到货提醒")
    @GetMapping("/CG/indexDHTX")
    public ApiResponse<List<IndexDHTXVo>> indexDHTX() {
        return ok(iPurchaseService.indexDHTX());
    }

}
